#ifndef DATABLOCK_H
#define DATABLOCK_H

#include <iostream>
#include <QImage>
#include <vector>

#include "point.h"
#include "pixel.h"
#include "canvas.h"
#include "converter.h"

using namespace std;

#define NUMERIC_MODE       1 //0001
#define ALPHA_NUMERIC_MODE 2 //0010
#define BINARY_MODE        4 //0100
#define JAPANESE_MODE      8 //1000

class datablock
{
public:
    datablock();
    vector<int> getDataBlocks (int versionINFO, int maskPattern, point origin, int pixelProportion, QImage* img);
    string decodeDataBlocks (vector<int> dataBlocks, int versionINFO);

    void setCanvas (canvas *log);

private:
    canvas *log;

    void unMask (int row, int col, int maskPattern, point origin, int pixelProportion, QImage* img);
    string decodeNumeric (int sizeDataLenght, int *numBlock, vector<int> dataBlocks);
    string decodeAlnum (int sizeDataLenght, int *numBlock, vector<int> dataBlocks);
    string decodeBinary (int sizeDataLenght, int *numBlock, vector<int> dataBlocks);
    string decodeJapanese (int sizeDataLenght, int *numBlock, vector<int> dataBlocks);
};

#endif // DATABLOCK_H
